package com.mihe.core.excption;


import com.mihe.core.constant.IResponseEnum;

/**
 * @author Dirk
 * @Date 2020-07-08 14:59
 */
public class BaseException extends RuntimeException {

    private static final long serialVersionUID = -2789990150758271257L;

    private int code;

    private String message;

    private IResponseEnum responseEnum;

    private Throwable cause;

    public BaseException() {
    }

    public BaseException(IResponseEnum responseEnum) {
        this.code = responseEnum.getCode();
        this.responseEnum = responseEnum;
        this.message = responseEnum.getMessage();
    }

    public BaseException(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public BaseException(IResponseEnum responseEnum, String message, Throwable cause) {
        this.code = responseEnum.getCode();
        this.responseEnum = responseEnum;
        this.message = message;
        this.cause = cause;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public IResponseEnum getResponseEnum() {
        return responseEnum;
    }

    public void setResponseEnum(IResponseEnum responseEnum) {
        this.responseEnum = responseEnum;
    }

    @Override
    public Throwable getCause() {
        return cause;
    }

    public void setCause(Throwable cause) {
        this.cause = cause;
    }
}
